﻿@model IEnumerable<Tesis2.Models.Solicitud>

@{
    ViewBag.Title = "Index";
    WebGrid grid = new WebGrid(Model);
}

<h2>Reporte de Solicitudes</h2>
<br />
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
        google.load("visualization", "1", {packages:["corechart"]});
        google.setOnLoadCallback(drawChart);
        function drawChart() {
            $.post('GetDataSolicitud', {}, function(data){
                var tdata = new google.visualization.DataTable();

                tdata.addColumn('string', 'Country');
                tdata.addColumn('number', 'Population');

                for (var i = 0; i < data.length; i++) {
                    tdata.addRow([data[i].Name, data[i].Value]);
                }

                var options = {
                    title: 'Solicitudes',
                    backgroundColor: '#efeeef'
                };

                var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
                chart.draw(tdata, options);
            });
        };
</script>

<div id="chart_div" style="width: 800px; height: 300px"></div>

@grid.GetHtml(columns: new [] {
    grid.Column("Numero",
                header: "Número"),
    grid.Column("Descripcion",
                header: "Descripción"),
    grid.Column("EstadoSolicitudID",
                header: "Estado"),
    grid.Column("UsuarioSolicitudID", 
                header: "Usuario"),
    grid.Column("FechaIngreso", 
                header: "Fecha Ingreso",
                format: p=>p.FechaIngreso.ToShortDateString()),
    grid.Column(
          "", 
          header: "Acciones",
          format: @<text>
                    @Html.ActionLink("Ver", "Details", new { id=item.SolicitudID }) 
                  </text>
    )
})



